<?php
include_once('../server/config.php');
include_once('../server/sqlControl.php');
	$min = 3;
	$max = 50;
	$choices = 10;
	$search = (string) stripslashes(strip_tags($_POST['search']));
	$result = array();

//quick validation
if(strlen($search) >= $min && strlen($search) <= $max)
{ 	  
  $tables = array();
  $tables[0] = 'inv_location';
  
  $fields = array();
  $fields[0] = 'locName';
  
  $whereClause = 'locName LIKE "%'.$search.'%" OR locDesc LIKE "%'.$search.'%"';
  
  $data = SQLRecover($tables, $fields, $whereClause);
  
  $return = '';
  
  if($data['queryStatus'] != 'DB Query success!')
  {
	$return = 'No Location Entries Found';
  }
  else
  {
  	for ($i=0; $i<sizeOf($data['locName']); $i++)
  	{
  		$return .= '<li>'.$data['locName'][$i].'</li>';
  	}
  }
  
  echo $return;
}
?>